#include<iostream>
using namespace std;
void getSting(string& s, string& copyS)
{
    for (int i = 0; i < s.size(); i++)
    {
        if (s[i] == '#')
        {
            if (copyS.size())
            {
                copyS.pop_back();
            }
        }
        else
        {
            copyS.push_back(s[i]);
        }
    }
}
bool backspaceCompare(string s, string t) {
    int leS = s.size();
    int leT = t.size();
    string copyS;
    string copyT;
    getSting(s, copyS);
    getSting(t, copyT);
    if (copyS == copyT)
    {
        return true;
    }
    return false;

}